package com.kfpanda.search.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Repository;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

@Repository("URLViewAction")
public class URLViewAction extends AbstractController {
	
	@Override
	protected ModelAndView handleRequestInternal(HttpServletRequest arg0,
			HttpServletResponse arg1) throws Exception {
		
		String uri = arg0.getRequestURI().trim();
		uri = uri.substring(1);
		String view = "";
		if(uri.indexOf("/") >= 0 && uri.indexOf(".") >= 0){
			view = uri.substring(uri.indexOf("/")+1,uri.indexOf("."));
		}
		return new ModelAndView(view);
	}
}
